package aiingames.simulation.server.physics;

import aiingames.Config;

public class Force {
	
	private double fx = 0;
	private double fy = 0;
	
	private double vx = 0;
	private double vy = 0;
	private double weight;

	public Force(double particleWeight) {
		this.weight = particleWeight;
	}
	// double fz;

	/* package */double getXComponent() {
		return this.fx;
	}

	/* package */double getYComponent() {
		return this.fy;
	}

	/* package */void setXComponent(double fx) {
		this.fx = fx;
	}

	/* package */void setYComponent(double fy) {
		this.fy = fy;
	}

	/* package */void incrementX(double incrfx) {
		this.fx += incrfx;
	}

	/* package */void incrementY(double incrfy) {
		this.fy += incrfy;
	}
	
	public double getVx() {
		return this.vx;
	}
	
	public double getVy() {
		return this.vy;
	}
	
	public void setVx(double vx) {
		this.vx = vx;
	}
	
	public void setVy(double vy) {
		this.vy = vy;
	}
	
	
	public void update() {
		this.vx += fx*Config.TIME_STEP_SIZE/this.weight;
		this.vy += fy*Config.TIME_STEP_SIZE/this.weight;
		this.fx = 0;
		this.fy = 0;
	}

	public void reset() {
		this.vx = 0;
		this.vy = 0;
		this.fx = 0;
		this.fy = 0;
	}
}
